package com.fangxing.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtils {


    public static boolean isEmail(String str) {
       boolean tag = true;
       final String pattern1 = "^([a-z0-9A-Z]+[-|//.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?//.)+[a-zA-Z]{2,}$";
       final Pattern pattern = Pattern.compile(pattern1);
       final Matcher mat = pattern.matcher(str);
       if (!mat.find()) {
           tag = false;
       }
       return tag;
    }

    public static boolean isPhoneNo(String str) {
        String regExp = "^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        Pattern p = Pattern.compile(regExp);
        Matcher m = p.matcher(str);
        return m.matches();
    }

}
